package com.example;

import java.awt.print.Printable;

/**
 * @Auther: shiquan
 * @Date: 2024/10/13 - 10 - 13 -16:49
 */
public class Test5 {
    public static void main(String[] args) {
        int [] arr ={1,2,3,4,5};
        //调用方法遍历数组
        printArray(arr);
        //System.out.println("abc");

    }
    public static void printArray(int[] arr){
        System.out.print("[");
        for (int i = 0; i < arr.length; i++) {
            if (i == arr.length - 1){
            System.out.print(arr[i]);
        }else{
                System.out.print(arr[i] + ",");
            }
        }

        System.out.println("]");
    }
}
